import { lazy } from "react";
import { createHashRouter } from "react-router-dom";

import Layouts from "@/pages/layouts/layouts";
import Home from "@/pages/tabbar/Home/Home";
import U2U from "@/pages/tabbar/U2U/U2U";
import STC from "@/pages/tabbar/STC/STC";
import Resettle from "@/pages/tabbar/Resettle/Resettle";
import News from "@/pages/tabbar/News/News";
const NewsDetail = lazy(() => import("@/pages/tabbar/News/NewsDetail"));
const BuyComponent = lazy(() => import("@/pages/tabbar/U2U/Subpage/Buy/Buy"));
const SellComponent = lazy(
  () => import("@/pages/tabbar/U2U/Subpage/Sell/Sell")
);
const Invite = lazy(() => import("@/pages/Invite/Invite"));
const UpdatePassword = lazy(
  () => import("@/pages/UpdatePassword/UpdatePassword")
);
const DigitalVoucherCenter = lazy(
  () => import("@/pages/DigitalVoucherCenter/DigitalVoucherCenter")
);
// 新增买入
const Buy = lazy(() => import("@/pages/Buy/Buy"));
const STCBuyRecord = lazy(() => import("@/pages/STCRecord/STCRecord"));
const Upgrade = lazy(() => import("@/pages/Upgrade/Upgrade"));
const RewardRecord = lazy(() => import("@/pages/RewardRecord/RewardRecord"));
const U2URecord = lazy(() => import("@/pages/U2URecord/U2URecord"));
const PlacementAccount = lazy(
  () => import("@/pages/PlacementAccount/PlacementAccount")
);
const Network = lazy(
  () => import("@/pages/RecommendationNetwork/RecommendationNetwork")
);
const Settings = lazy(
  () => import("@/pages/tabbar/Home/Subpage/Settings/Settings")
);
const CustomerService = lazy(
  () => import("@/pages/CustomerService/CustomerService")
);

const Recharge = lazy(() => import("@/pages/Transaction/Recharge/Recharge"));
const Withdrawal = lazy(
  () => import("@/pages/Transaction/Withdrawal/Withdrawal")
);
const TransferAccounts = lazy(
  () => import("@/pages/Transaction/TransferAccounts/TransferAccounts")
);
const Exchange = lazy(() => import("@/pages/Transaction/Exchange/Exchange"));
const AccountDetail = lazy(() => import("@/pages/AccountDetail/AccountDetail"));
const routes = createHashRouter(
  [
    {
      path: "/",
      element: <Layouts />,
      children: [
        {
          path: "/",
          element: <Home />,
        },
        {
          path: "/u2u",
          element: <U2U />,
        },
        {
          path: "/stc",
          element: <STC />,
        },
        {
          path: "/resettle",
          element: <Resettle />,
        },
        {
          path: "/news",
          element: <News />,
        },
      ],
    },
    {
      path: "/newsDetail/:id",
      element: <NewsDetail />,
    },
    {
      path: "/U2U/buy",
      element: <BuyComponent />,
    },
    {
      path: "/U2U/sell",
      element: <SellComponent />,
    },
    {
      path: "/invite",
      element: <Invite />,
    },
    {
      path: "/updatePassword",
      element: <UpdatePassword />,
    },
    {
      path: "/digitalVoucherCenter",
      element: <DigitalVoucherCenter />,
    },
    {
      path: "/buy",
      element: <Buy />,
    },
    {
      path: "/STCRecord/:type",
      element: <STCBuyRecord />,
    },
    {
      path: "/U2URecord/:type",
      element: <U2URecord />,
    },
    {
      path: "/upgrade",
      element: <Upgrade />,
    },
    {
      path: "/rewardRecord",
      element: <RewardRecord />,
    },
    {
      path: "/placementAccount",
      element: <PlacementAccount />,
    },
    {
      path: "/network",
      element: <Network />,
    },
    {
      path: "/settings",
      element: <Settings />,
    },
    {
      path: "/customerService",
      element: <CustomerService />,
    },
    {
      path: "/recharge",
      element: <Recharge />,
    },
    {
      path: "/withdraw",
      element: <Withdrawal />,
    },
    {
      path: "/transfer",
      element: <TransferAccounts />,
    },
    {
      path: "/exchange",
      element: <Exchange />,
    },
    {
      path: "/accountDetail",
      element: <AccountDetail />,
    },
  ],
  {
    // basename: '/dapp/',
    future: {
      v7_normalizeFormMethod: true,
      v7_relativeSplatPath: true,
      v7_fetcherPersist: true,
      v7_partialHydration: true,
      v7_skipActionErrorRevalidation: true,
    },
  }
);
export default routes;
